<?php
namespace App\Goods\Models;


use Illuminate\Database\Eloquent\Model;

class GoodsBase extends Model
{
    protected $table = 'zwj_crm_goods_bases';

    protected $guarded = [];

    public function hasAttr()
    {
        return $this->belongsToMany(GoodsAttr::class, GoodsBaseAttr::class, 'base_id', 'attr_id')->withPivot('value');
    }

    public function hasImages()
    {
        return $this->hasMany(GoodsBaseImage::class, 'base_id');
    }

}
